package study.intconsulting.services;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

import study.intconsulting.transform.Trans;
import study.intconsulting.vo.PcInfo;

public class RayService{

	
	public void execute(String name){

		PcInfo pi = new PcInfo();
		pi.setName(name);
		
		Trans trans = new Trans();
		//trans.mh(pi);
		try {
			execute(trans.mh(pi));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public void execute(PcInfo pi)
	throws FileNotFoundException,IOException{
		
		FileOutputStream fos = null;
		
		try{
			
			fos = new FileOutputStream("C:\\int.txt");

			String message = pi.toString();
			System.out.println(pi.toString());
			
			fos.write(message.getBytes());
			
			
		}catch(FileNotFoundException fnfe){
			fnfe.printStackTrace();
		}catch(IOException ie){
			ie.printStackTrace();
		}finally{
			try{
				if(fos!=null) fos.close();
			}catch(IOException ioe){
				ioe.printStackTrace();
			}
		}
	}
}
